//login.js
//获取应用实例
var app = getApp()
var order = ['red', 'yellow', 'blue', 'green', 'red']
Page({
  data: {
    toView: 'red',
    scrollTop: 100,
    prieod:"76",
    path:'',
    type:'1'
  },
  upper: function(e) {
    console.log(e)
  },
  lower: function(e) {
    console.log(e)
  },
  scroll: function(e) {
    console.log(e)
  },
  tap: function(e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1]
        })
        break
      }
    }
  },
  tapMove: function(e) {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  },
  onLoad:function(options){
    var that = this;
    console.log('----------------'+options.path);
    console.log(that)
    that.setData({
      path: options.path,
      type:options.type
    })
  },
  onReady:function(){
    wx.setNavigationBarTitle({title: '水浒卡',success: function(res) {}})
  },
  toHistory:function(e){
   wx.switchTab({
      url: '../video/video'
    })
  },
  bindGetUserInfo: function () {
	  var that = this
    wx.getUserInfo({
      success: function (res) {
        console.log("bindGetUserInfo userInfo:" + res)
        app.globalData.userInfo = res.userInfo
		    console.log(that.data.path)
        if(that.data.type == '1') {
          wx.navigateTo({
            url: that.data.path
          })
        } else {
          wx.navigateBack()
        }
      },
      fail: function (res) {
        wx.navigateBack()
      }
    })
  }
})
